/*  
	This file is a part of AI game assignment.
	
	Author : Satya Gautham Merla

*/
#include <iostream>
#include <time.h>
#include <pthread.h>

#define DEBUG

#define BLUE 1
#define RED  2
#define EMPTY 0

#define ROW_SIZE 8
#define COL_SIZE 8

int tempBoard[ROW_SIZE][COL_SIZE];	//temp value of board given to players
int tempTimeLimit;			//temp value of time limit given to players
int tempPresentCol;			//players color
int done;				

struct move
{
	int x_pos;
	int y_pos;
};

void* playerOneMove(void *);
void* playerTwoMove(void *);

class Game
{
	private:
		int board [ROW_SIZE][COL_SIZE]; 	//The board
		int timeLimit ; 			// Timer in milli sec

		int colOfPlayer[2];			//color of player 

	
		int scoreOne ;				// scores 2 if won ;1 for draw; 
		int scoreTwo ;				// 0 for loss
		
		int pointsOne;				// no of coins 
		int pointsTwo;
		
		void initialize();

		void getMove(int , struct move *);
		int hasMove(int color);			//returns 0 if no move else 1	
		int lenth(int i, int j, int inc_i, int inc_j, int oppColor);
		int isValidMove(int color, int i, int j);
		int count (int color);
		void updateMove(int color, int i, int j);
		void change(int i, int j, int inc_i, int inc_j, int len, int color);//update the board after move

	public:
		void run();				// driver function
		void printBoard();			// prints the board
};

